<?php
/**
 * Форма без выведения декораторов по-умолчанию. Более гибкий способ
 * 
 * @author diotheos
 *
 */ 

use Managers\Exception;
class Lib_Form_Clear extends Zend_Form{
    public function init(){
        parent::init();
        $this->addElementPrefixPath('Lib_Form_Validate','Lib/Form/Validate/', 'validate');
        $this->addElementPrefixPath('Lib_Form_Filter','Lib/Form/Filter/', 'filter');
        $this->addElementPrefixPath('Lib_Form_Decorator','Lib/Form/Decorator/', 'decorator');
        
        return $this;
    }
    
    public function render(Zend_View_Interface $view = null){
    	$elements = $this->getElements();
        foreach ($elements as $element) {
            $element->removeDecorator('HtmlTag');
            $element->removeDecorator('label');
        }
        return parent::render($view);        
    }
    
    public static function toEntity($entityName=''){
        if(!$entityName)throw new Exception('Не указано имя сущности');
        $params=array();
        
        
        $doctrine = new \Lib\Model\DoctrineManager();
        $em = $doctrine->getEntityManager();

        $fields = $em->getMetadataFor($entityName);
        
        print '<pre>';
        print_r($fields);
        print '<pre>';
        die;
        
//        print_r(get_class_vars(get_class($class)));
        print '<pre>';
        die;
        
        $class = new $entityName;
    }
}